/*
Data and Code correspond with paper published in Criminology
Barnum et l., Reactive Guardianship: Who Intervenes? How? and Why?
*/

* All analyses conducted in Stata 17.

/// Commands Needed \\\

* collin, coefplot 


/*						**** Notes About Data ****

Only 1032 cases used in subsequent analyses retained.
Only variables used in subsequent analyses retained.
(code to reduce data and sample size below)

Go to https://www.jacobscenter.uzh.ch/en/research/zproso/aboutus.html access full 
z-proso data. Note, the subsequent code will work with full raw data.

*/

********************************************************************************
********************************************************************************


		/////// Reactive Guardianship Cleaning and Analysis Code \\\\\\\\

		
/// Randomizing order and creating ID \\\

set seed 12345
gen randorder = runiform()
sort randorder

gen ID = _n
label var ID "Unique ID"



			*--------------Variable Cleaning-----------------*

  **************** Original Z-Proso wave 8 and 9 variables ****************

/// Gender \\\

tab ADR_GenderChild, nolab
recode ADR_GenderChild (2=0), gen(male)
tab male // 870 males (with full data)
label var male "Gender, male = 1"

/// Age \\\

sum K8_AgeYears K9_AgeYears
gen age8 = K8_AgeYears
gen age9 = K9_AgeYears
label var age8 "Age in Years at wave 8"
label var age9 "Age in Years at wave 9"

sum age8 age9


/// Education Level \\\

tab1 K9_1890_ISCED K9_edyears
gen edyears9 = K9_edyears
label var edyears9 "Years of Education at wave 9"

gen K9_diploma = K9_1890_ISCED
label define K9_diploma 1 "secondary 1" 2 "secondary 2" 3 "BA" 4 "MA", replace
label val K9_diploma K9_diploma
label var K9_diploma "Highest Diploma Received"

/// Height in cm \\\

tab1 K8_103 K9_103
gen height8 = K8_103
gen height9 = K9_103
sum height8 height9
label var height8 "Height in cm at wave 8"
label var height9 "Height in cm at wave 9"


/// Low Self-Control \\\

alpha K8_1701 K8_1710 K8_1709 K8_1706 K8_1713 K8_1703 K8_1707 K8_1702 K8_1712 ///
K8_1704, gen(lselfcontrol8)
label var lselfcontrol8 "Low Self-Control at wave 8"

alpha K9_1701 K9_1710 K9_1709 K9_1706 K9_1713 K9_1703 K9_1707 K9_1702 K9_1712 ///
K9_1704, gen(lselfcontrol9)
label var lselfcontrol9 "Low Self-Control at wave 9"


/// Perceived Physical Prowess \\\

tab1 K8_962F K8_962M
tab1 K8_963F K8_963M

gen Fstronger8 = K8_962F
gen Mstronger8 = K8_962M
gen stronger8 = Fstronger8
replace stronger8 = Mstronger8 if stronger8==.
label var stronger8 "Thinks he/she is stronger than peers"
tab stronger8

gen Ftougher8 = K8_963F
gen Mtougher8 = K8_963M
gen tougher8 = Ftougher8
replace tougher8 = Mtougher8 if tougher8==.
label var tougher8 "Thinks he/she is physically tougher in a fight than peers"
tab tougher8

alpha stronger8 tougher8, gen(badass8)
label var badass8 "Perceived Physical Prowess at wave 8"

/// Prosociality \\\

alpha K8_601 K8_607 K8_611 K8_617 K8_620, gen(peacekeeping8)
label var peacekeeping8 "Prosociality at wave 8"


/// Moral Neutralization \\\

alpha K8_552 K8_553 K8_554 K8_556 K8_558 K8_568 K8_561 K8_565 K8_569 K8_566 ///
K8_567 K8_571, gen(F_mjust8)
label var F_mjust8 "Moral Neutralization at wave 8"


********************************************************************************
********************************************************************************

	  **************** Situational wave 9 variables ****************


/// Situational Interpretations \\\

tab1 K9_6002 K9_6003 K9_6004 K9_6005


foreach v in K9_6002 K9_6003 K9_6004 K9_6005 {
	recode `v' (1=5) (2=4) (3=3) (5=1) (4=2), gen(rev`v')
}
 
gen interpt1 = revK9_6002 
label var interpt1 "He has done nothing wrong"

gen interpt2 = revK9_6003 
label var interpt2 "He harassed the woman in an inappropriate way"

gen interpt3 = revK9_6004 
label var interpt3 "He made physical contact with the woman in an inappropriate manner"

gen interpt4 = revK9_6005
label var interpt4 "He has sexually molested the woman"


/// Intervention Outcomes \\\

tab1 K9_6006 K9_6007 K9_6008 K9_6009
revrs K9_6006 K9_6007 K9_6008 K9_6009

gen interven1 = revK9_6006 
label var interven1 "wait and see what happens"
gen interven2 = revK9_6007 
label var interven2 "inform bartender or bouncer"
gen interven3 = revK9_6008
label var interven3 "intervene verbally"
gen interven4 = revK9_6009
label var interven4 "intervene physically"


/// Prior Experience \\\

gen priorwitns = K9_6014
label var priorwit "Number of times seen something like this before"


*--Safety Considerations--*

/// Perceived Danger \\\

gen danger = K9_6012 
label var danger "How unsafe to physically intervene"

/// Others Intervene \\\

revrs K9_6010
gen otherinter = revK9_6010
label var otherinter "how likely is it that someone else would intervene on the woman's behalf?"

*--Socioemotional Considerations--*

/// Anger \\\

gen anger = K9_6001
label var anger "Angry about witnessing interaction in video"	

/// Social Approval of Violence \\\

gen socreward = K9_6013
label var socreward "would friend and family approve if physical intervention"

*--Moral Considerations--*

/// Situational Violenc Acceptability \\\

revrs K9_6011 
gen moralacpt = revK9_6011
label var moralacpt "moral accept of physical intervention"


********************************************************************************
********************************************************************************


/// Final Var List \\\

	/*-------------- Missing Data  and Final Variables -----------------*
	
Note: code used to get final analytic sample.
If starting with raw z-proso data, run this code after cleaning variables above.


/// Analytic Sample after Listwise Deletion \\\

misstable sum age9 height9 lselfcontrol9 edyears9 badass8 peacekeeping8 F_mjust8 ///
interpt1 interpt2 interpt3 interpt4 interven1 interven2 interven3 interven4 ///
priorwitns danger otherinter anger socreward moralacpt 

*final n Based On Variables to be used in regressions

misschk height9 lselfcontrol9 edyears9 badass8 peacekeeping8 F_mjust8 ///
interpt4 interven1 interven2 interven3 interven4 ///
priorwitns danger otherinter anger socreward moralacpt, gen(miss) 

gen NoMissing = 1 if missnumber==0 // N = 1032 (90% at wave 9)

keep if NoMissing==1



/// to keep only orginal variables cleaned for anlysis \\\  

keep ADR_GenderChild K8_AgeYears K9_AgeYears K9_1890_ISCED K9_edyears K8_103 K9_103 ///
K8_1701 K8_1710 K8_1709 K8_1706 K8_1713 K8_1703 K8_1707 K8_1702 K8_1712 K8_1704 ///
K9_1701 K9_1710 K9_1709 K9_1706 K9_1713 K9_1703 K9_1707 K9_1702 K9_1712 K9_1704 ///
K8_962F K8_962M K8_963F K8_963M K8_601 K8_607 K8_611 K8_617 K8_620 K8_552 K8_553 /// 
K8_554 K8_556 K8_558 K8_568 K8_561 K8_565 K8_569 K8_566 K8_567 K8_571 ///
K9_6002 K9_6003 K9_6004 K9_6005 K9_6006 K9_6007 K9_6008 K9_6009 K9_6014 K9_6012 ///
K9_6010 K9_6001 K9_6013 K9_6011


/// to keep only cleaned variables \\\

keep ID male age9 height9 lselfcontrol9 edyears9 badass8 peacekeeping8 F_mjust8 ///
interpt1 interpt2 interpt3 interpt4 interven1 interven2 interven3 interven4 ///
priorwitns danger otherinter anger socreward moralacpt 

*/

sum male age9 height9 lselfcontrol9 edyears9 badass8 peacekeeping8 F_mjust8 ///
interpt1 interpt2 interpt3 interpt4 interven1 interven2 interven3 interven4 ///
priorwitns danger otherinter anger socreward moralacpt 


********************************************************************************
********************************************************************************


		 *-------------- collinearity diagnostics -----------------*

corr male priorwitns peacekeeping8 danger otherinter badass8 anger socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9
collin male priorwitns peacekeeping8 danger otherinter badass8 anger socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9



********************************************************************************
********************************************************************************



			*-------------- Analyses -----------------*


				
*-- Interpretaion Histograms --*

sum interpt*

hist interpt1, percent
hist interpt2, percent
hist interpt3, percent
hist interpt4, percent

		
*-- Intervention Histograms --*

sum interven*
			
hist interven1, percent
hist interven2, percent
hist interven3, percent
hist interven4, percent

*-- Descriptive Statistics --*

sum male height9 lselfcontrol9 edyears9 badass8 peacekeeping8 F_mjust8 ///
priorwitns danger otherinter anger socreward moralacpt 
						
						
*-- OLS Regressions --*

*Note: coefplot used for presentations only.

/// Wait and See - Predicted Only \\\

reg interven1 male priorwitns peacekeeping8 danger  badass8 anger  F_mjust8  ///
lselfcontrol9 height9 edyears9 ,  vce(robust) b
eststo Reduced 

/// Wait and See - Full \\\

reg interven1 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9,  vce(robust) b
eststo Full


coefplot Reduced Full, xline(0) drop(_cons) nolab title(OLS Wait and See) ///
xtitle(Standardized Coefficients) xtitle(Standardized Coefficients) ///
order(male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9)

**********************************


/// Seek Help - Predicted Only \\\

reg interven2 male priorwitns peacekeeping8    anger  F_mjust8  lselfcontrol9 ///
height9 edyears9 ,  vce(robust) b
eststo Reduced


/// Seek Help - Full \\\

reg interven2 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9 ,  vce(robust) b
eststo Full

coefplot Reduced Full, xline(0) drop(_cons) nolab title(OLS Seek Help) ///
xtitle(Standardized Coefficients) xtitle(Standardized Coefficients) ///
order(male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9)

**********************************


/// Verbal - Predicted Only \\\

reg interven3 male priorwitns peacekeeping8 danger otherinter badass8 anger F_mjust8 ///
lselfcontrol9 height9 edyears9 ,  vce(robust) b
eststo Reduced

/// Verbal - Full \\\

reg interven3 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9,  vce(robust) b
eststo Full

coefplot Reduced Full, xline(0) drop(_cons) nolab title(OLS Verbal Intervention) ///
xtitle(Standardized Coefficients) xtitle(Standardized Coefficients) ///
order(male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9)

**********************************


/// Physical - Full \\\
reg interven4 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9 ,  vce(robust) b
eststo Predicted


coefplot Predicted, xline(0) drop(_cons) nolab title(OLS Physical Intervention) ///
xtitle(Standardized Coefficients) xtitle(Standardized Coefficients) ///
order(male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9)

********************************************************************************
********************************************************************************



      *************** Supplemental and Robustness Checks ******************


/// sex by prowess interaction check \\\

reg interven4 priorwitns peacekeeping8 danger otherinter c.badass8##male anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9,  vce(robust) b


*-- Robust Check: Ordered Logit Models --*

/// Wait and See \\\
ologit interven1 male priorwitns peacekeeping8 danger  badass8 anger  F_mjust8  ///
lselfcontrol9 height9 edyears9

/// Seek Help \\\
ologit interven2 male priorwitns peacekeeping8  anger  F_mjust8  lselfcontrol9 ///
height9 edyears9

/// Verbal \\\
ologit interven3 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
lselfcontrol9 height9 edyears9

/// Physical \\\
ologit interven4 male priorwitns peacekeeping8 danger otherinter badass8 anger ///
socreward F_mjust8 moralacpt lselfcontrol9 height9 edyears9




